﻿var mainPlayer: GameObject;

var missionCompleted : AudioClip;
var missionFailed: AudioClip;
var reportReceived: AudioClip;
var zombieKillSound: AudioClip;
var reportChord: AudioClip;
var playerKilled: AudioClip;
var playerStunned: AudioClip;
var reports: float;
var stunnedTimer: int;

function Start(){
   reports = 0.0;
   stunnedTimer = 0;
}


function Update() 
{
    GetState();
    if (stunnedTimer > 0)
		{
			stunnedTimer = stunnedTimer-1;
			if(stunnedTimer <=0){
				mainPlayer.SendMessage("getUnStunned");
			}
			
		}
}
 
 
function GetState() 
{
    
   
       if ( Input.GetKey( "1" )){
        // completeMission();
        mainPlayer.tag = "human";
       } else if (Input.GetKey("2")){
       //  failMission();
        mainPlayer.tag = "zombie";
       } else if (Input.GetKey("3")){
          mainPlayer.tag = "admin";
       } else if (Input.GetKey("r")){
       		getReport();
       }
       
}
 
 
function completeMission(){
   audio.Stop();
   
   audio.PlayOneShot(missionCompleted, 1.0);
   
 } 

function failMission(){
   audio.Stop();
   audio.PlayOneShot(missionFailed, 1.0);
   
 } 
 
 function getReport(){
//   audio.Stop();
//   audio.PlayOneShot(reportReceived, 1.0);
//   var tempPitch = audio.pitch;
//   audio.pitch = reports;
//   audio.PlayOneShot(reportChord, 1.0);
//   if(reports < 1.0){
//     reports += .01;
//   }
//   audio.pitch = tempPitch;
 }
 
 function zombieKill(){
   audio.Stop();
   audio.PlayOneShot(zombieKillSound, 1.0);
 }
 
 function getKilled(){
 	print("killed");
   audio.Stop();
   audio.PlayOneShot(playerKilled, 1.0);
 }
 
 function killHuman(){
 
 }
 
 function getStunned(){
 	audio.Stop();
 	audio.PlayOneShot(playerStunned, 0.8);
 	//Add stunned methods here
 	mainPlayer.SendMessage("getStun");
 	stunnedTimer = 1000;
 }
 
 